<!-- ************************************************************************************************************ -->
<!-- fileName          : EditContentlinkPage.jsp																  -->
<!-- author            : 马文军 																					  --> 
<!-- createDate        : 2015/01/06 																			  -->
<!-- summary           : admin端  “文章标题处链接” 编辑 页面   后台逻辑 													  		  -->
<!-- modifiedBy        : 马文军																				      -->
<!-- ************************************************************************************************************ -->

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>EditContentlinkPage</title>
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="../ckeditor/config.js"></script>
<script type="text/javascript">
    window.onload = function()
    {
        CKEDITOR.replace( 'content',{
        	height:693,
        	})
    }
</script>
<style type="text/css">
body{
background-image:url(../../image/admin_bg.png);
background-repeat:repeat-x;
margin-left: 0px;
margin-top: 0px;
margin-right: 1px;
margin-bottom: 0px;
font-family:Microsoft YaHei;
}
h2{
font-family:Microsoft YaHei;
color:#fff;
margin: 5px 5px 5px 5px;
font-size:16px;
}
</style>

</head>
<body>
<%
	//设置请求的字符编码以支持中文
	request.setCharacterEncoding ("utf-8");

	//从请求页面获取表单参数
	String id = request.getParameter("id");
	System.out.println("编辑contentlink页面	id="+id);

	//从web.xml文件获取全局参数
	String drv=config.getServletContext().getInitParameter("DBDriver");
	String url=config.getServletContext().getInitParameter("DBURL");
	String uid=config.getServletContext().getInitParameter("DBUser");
	String pwd=config.getServletContext().getInitParameter("DBPass");
	
    //构建SQL字符串和JDBC对象
    
	String strSQL = "SELECT * FROM immie0_immi.contentlink cl WHERE cl.id=?";	// (id, name, content_name, content, url, father_id, date)
	Connection conn = null;
	PreparedStatement pstmt = null;	
	ResultSet rs = null;
	
	try {
		Class.forName(drv).newInstance();
		conn = DriverManager.getConnection(url,uid,pwd);
		pstmt = conn.prepareStatement(strSQL);
		pstmt.setString(1, id);

		rs = pstmt.executeQuery();
		rs.next();
%>
<h2>编辑页面</h2>
	<div style="margin-top:10px;">	
		<form id="pageForm" method="post" action="SaveContentlinkPage.do">
			<div style="display:none;">
			页面ID：<input type="text" style="width: 500px;"name="id" id="id" value="<%= rs.getString(1) %>"/>
			</div>
			<div style="margin-left:5px;">
			页面标题：<input type="text" style="width: 500px;"name="title" id="title" value="<%= rs.getString(2) %>"/>
			</div>
			<div style="margin-left:5px;">
			内容标题：<input type="text" style="width: 500px;"name="content_name" id="content_name" value="<%= rs.getString(3) %>"/>
			</div>
			<div style="margin-left:5px;margin-right:1px;">
			<textarea name="content" id="content" ><%= rs.getString(4) %> </textarea>
			</div>
		</form>
	</div>
<%      

	} catch (ClassNotFoundException e) {
		e.printStackTrace();
	} catch (InstantiationException e) {
	    e.printStackTrace();
	} catch (IllegalAccessException e) {
		e.printStackTrace();
	} catch (SQLException e) {
		e.printStackTrace();
	} 
	finally {
		if (rs != null) {
			rs.close();
			rs = null;
		}
		if (pstmt != null) {
			pstmt.close();
			pstmt = null;
		}		
		if (conn != null) {
			conn.close();
			conn = null;
		}
	}
%>
</body>
</html>